class Content < ActiveRecord::Base
  set_table_name :eshop_contents

  paginates_per 15

  has_paper_trail
  diff :exclude => [:id, :created_at, :updated_at]

  belongs_to :user
  
  validates :presentation, :name, :length => {:maximum => 32}, :presence => true
  validates :name, :format => {:with => Format::STRING_REGEX}
  validates :name, :uniqueness => true, :format => {:with => Format::STRING_REGEX}
  validates :group, :presence => true, :inclusion => {:in => ["system", "shop"]}
  validates :title, :length => {:maximum => 200}

  def get_text(name)
    where(:name => name)
  end
end
